using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Exercise2
{
    class AreaOFShape
    {
        public static double calculateArea(double length, double width)
        {
            double area = length * width;
            return area;
        }
        static void Main(string[] args)
        {
            double lengthX = 0;
            double widthY = 0;
            double areaOfShadedRegion = 0;
            double areaRect1 = 0;
            double areaRect2 = 0;
            double areaExistingSquare = 0;
            const int lengthOfExistingSquare = 2;//2 is the number given by the Figure 1 in the exercise2
            const int widthOfExistingSquare = 2;//2 is the number given by the Figure 1 in the exercise2


            Console.WriteLine("Please enter the length of the shape please:");
            lengthX = Convert.ToDouble(Console.ReadLine());

                while(lengthX<8) //7 is the number given by the Figure 1 in the exercise2
                    {
                        Console.WriteLine("Wrong input. Number must be greater than 7.");
                        lengthX = Convert.ToDouble(Console.ReadLine());
                    }

            Console.WriteLine("Please enter the width of the shape please:");
            widthY = Convert.ToDouble(Console.ReadLine());

while (widthY < 4) //3 is the number given by the Figure 1 in the exercise2
                    {

                        Console.WriteLine("Wrong input. Number must be greater than 3.");
                        widthY = Convert.ToDouble(Console.ReadLine());
                    }

            areaRect1 = calculateArea(lengthX, 3); //3 is the number given by the Figure 1 in the execise2
            Console.WriteLine("Area of the first Rectangle is:{0}", areaRect1);

            areaRect2 = calculateArea(lengthX -7, widthY-3); //7 and 3 are the number given by the Figure 1 in the execise2
            Console.WriteLine("Area of the first Rectangle is:{0}", areaRect2);

            areaExistingSquare = calculateArea(lengthOfExistingSquare, widthOfExistingSquare);
            Console.WriteLine("Area of existing square is: {0}", areaExistingSquare);

            areaOfShadedRegion = (areaRect1 + areaRect2) - areaExistingSquare;
            Console.WriteLine("Area of Shaded Shape is: {0}", areaOfShadedRegion);
        }
    }
}
